package com.orange.delivery.presentation.panel;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.francetelecom.clara.component.wicket.app.popin.OPopinContainer;
import com.orange.delivery.model.MarketBean;
import com.orange.delivery.technicalservice.exception.InvalidMarketException;

public class CreateMarketPanel extends CreateOrUpdateMarketPanel {

	private static final long serialVersionUID = 1L;
	private static final Logger LOG = LoggerFactory.getLogger(CreateMarketPanel.class.getName());

	public CreateMarketPanel(String id, OPopinContainer modalCreatePopIn) {
		super(id, new MarketBean(), modalCreatePopIn);

	}

	@Override
	protected void createComponents() {
		if (LOG.isDebugEnabled()) {
			LOG.debug("modal page for market creation");
		}

	}

	@Override
	protected Action createOrUpdateMarket(MarketBean marketBean) throws InvalidMarketException {
		if (LOG.isDebugEnabled()) {
			LOG.debug("creating market, parameters = " + marketBean.toString());
		}
		manageMarket.createMarket(marketBean);
		return Action.CREATED;

	}

}
